

{% extends "base/base_index.html" %}
{% block main %}
<ol class="breadcrumb">
  {%load class_menu_tags%}
  {{instance.classId|getClassTopMenuHtml}}
</ol>
<div class="panel panel-default">
  <div class="panel-heading">
    {{instance.title}}</br><a href="{%url users_show instance.addUser.id%}">{{instance.addUser.first_name}}</a>[{{instance.addTime|date:"Y-m-d H:i:s"}}]
  </div>
  <div class="panel-body">
    {%if instance.isLock%}
    主题被锁定！
    {%else%}

    {{instance.content|safe}}


    {%if instance.isVote%}
    {%if isVote%}
    {%for vote in voteList%}
    {{vote.content}}
    <div class="progress">
      <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width:{%  widthratio vote.voteCount totalCount 100 %}%">
        <span class="sr-only">20% Complete</span>
      </div>
    </div>
    {%endfor%}
    {%else%}
    <form role="form" action="{%url bbsTheme_vote instance.id%}" method="post">
      {%for vote in voteList%}
      <div class="radio">
        <label>
          <input type="radio" name="voteValue" id="voteValue" value="{{vote.id}}" >
          {{vote.content}}
        </label>
      </div>
      {%endfor%}
      <button type="submit" class="btn btn-default">投票</button>
    </form>
    {%endif%}
    {%endif%}

    {%endif%}<!-- 锁定 -->








 </div>
    {%block theme%}
    {%endblock%}
    <div class="panel panel-info">
      {%for bbsReply in replyList%}
      <div class="panel-heading"><a href="{%url users_show bbsReply.addUser.id%}">{{bbsReply.addUser.first_name}}</a>[{{bbsReply.addTime|date:"Y-m-d H:i:s"}}]</div>
      <div class="panel-body">
       {{bbsReply.content|safe}}
     </div>
     {%endfor%}

   </div>

 <div class="panel-footer">

  <div class="btn-group">
    <a class="btn btn-default" role="button" href="{%url HelpReport_add ''%}?url={{request.get_full_path}}">举报</a>


{% ifequal request.user instance.addUser %}
    <a class="btn btn-default" role="button" href="{{instance.classId.typeId.urlAdd}}{{instance.id}}/?classId={{instance.classId.id}}&vote={{instance.isVote}}">编辑</a>
{% endifequal %}

    {%if isClassManager%}
    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
      管理 <span class="caret"></span>
    </button>
    <ul id="manage" class="dropdown-menu" role="menu">
       <li> <a class="btn btn-default" role="button" href="{{instance.classId.typeId.urlAdd}}{{instance.id}}/?classId={{instance.classId.id}}&vote={{instance.isVote}}">编辑</a> </li>
      {%if instance.isTop%}
      <li> <button  type="button" class="btn btn-primary" action="isTop" value="0">取消置顶</button> </li>
      {%else%}
      <li> <button  type="button" class="btn btn-primary" action="isTop" value="1">置顶</button> </li>
      {%endif%}
      {%if instance.isLock%}
      <li> <button  type="button" class="btn btn-primary" action="isLock" value="0">取消锁定</button> </li>
      {%else%}
      <li> <button  type="button" class="btn btn-primary" action="isLock" value="1">锁定</button> </li>
      {%endif%}

      {%if instance.isClose%}
      <li> <button  type="button" class="btn btn-primary" action="isClose" value="0">取消结贴</button> </li>
      {%else%}
      <li> <button  type="button" class="btn btn-primary" action="isClose" value="1">结贴</button> </li>
      {%endif%}
      {%if instance.isHighlight%}
      <li> <button  type="button" class="btn btn-primary" action="isHighlight" value="0">取消高亮</button> </li>
      {%else%}
      <li> <button  type="button" class="btn btn-primary" action="isHighlight" value="1">高亮</button> </li>
      {%endif%}
      {%if instance.isBoutique%}
      <li> <button  type="button" class="btn btn-primary" action="isBoutique" value="0">取消精华</button> </li>
      {%else%}
      <li> <button  type="button" class="btn btn-primary" action="isBoutique" value="1">精华</button> </li>
      {%endif%}


      {%if instance.isSink%}
      <li> <button  type="button" class="btn btn-info">取消提沉</button> </li>
      {%else%}
      <li> <button  type="button" class="btn btn-info">提沉</button> </li>
      {%endif%}


      <li> <button  type="button" class="btn btn-success" action="del">删除</button> </li>

      <li><a href="{%url bbsTheme_move instance.id%}" class="btn btn-default" role="button">移动</a></li>

    {%endif%}



    </ul>
  </div>

  <br>
  <a href="{%url bbsReply_list instance.id%}">查看更多回复</a>

</div>
</div>
{%if isClassManager%}
<!-- Modal -->
<div class="modal fade" id="action_confirm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <form method="post" action="{%url bbsTheme_action instance.id%}">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title" id="myModalLabel"><span id="action_confirm_id"></span></h4>
        </div>
        <div class="modal-body">
          <input id="action_confirm_action" type="hidden" value="" name="action">
          <input id="action_confirm_action_value" type="hidden" value="" name="action_value">

          <span  id="action_confirm_content"></span><input type="text" class="form-control" placeholder="">
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary" id="action_confirm_yes">确定</button>
        </div>
      </form>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
  function modal_confirm(action,flag,text)
  {
    if (flag==undefined)
    {
      flag=1;
    }
    title="确认"+text+"吗？"
    content=text+"原因："


    $("#action_confirm_id").text(title);
    $("#action_confirm_content").html(content);

    $("#action_confirm_action").val(action);
    $("#action_confirm_action_value").val(flag);

    $('#action_confirm').modal('show');

  }

  $(function ()
  {
    m_li = $("#manage li");
    m_li.find('.btn-primary').click(function(event) {
      /* Act on the event */
      obj=$(this);
      modal_confirm(obj.attr('action'),obj.attr('value'),obj.text());
    });
    m_li.find('.btn-success').click(function(event) {
      obj=$(this);
      modal_confirm(obj.attr('action'),'1',obj.text());
    });

  });

</script>
{%endif%}

{%if  instance.isClose%}
<pre> <code>已结束主题</code></pre>
{%elif instance.isLock%}
<pre> <code>已锁定主题</code></pre>
{%else%}
        {%if instance.classId.isAllowAddReply%}
        {%if request.user.is_authenticated %}
<form method="post">
  {{replyForm.media}}
  {{ replyForm.content }}<br/>
  <button type="submit" class="btn btn-default">发表回复</button>
</form>
        {%else%}
        <div class="breadcrumb"><a href="{%url users_login%}?url={{request.path}}">登陆</a>后方可发表回复</div>
        {%endif%}

        {%else%}
        <pre> <code>本版主题禁止回复</code></pre>
        {%endif%}

{%endif%}






{%endblock%}